home *** CD-ROM | disk | FTP | other *** search
/ Champak 74 / Volume 74 My Disc - Damaged.iso / Games / super_fishing.swf / scripts / DoInitAction.as
Text File  |  2008-08-08  |  2KB  |  54 lines

  1. _global.api = new Object();
  2. _global.api.highscore = new Object();
  3. _global.api.highscore.initSession = function()
  4. {
  5.    this.session = "";
  6.    while(this.session.length < 20)
  7.    {
  8.       this.session += this.charTable.charAt(Math.round(Math.random() * (this.charTable.length - 1)));
  9.    }
  10.    this.charTableIndex = new Array();
  11.    var i = 0;
  12.    while(i < this.charTable.length)
  13.    {
  14.       this.charTableIndex[this.charTable.charCodeAt(i)] = i;
  15.       i++;
  16.    }
  17. };
  18. _global.api.highscore.submit = function(pGame, pDisciple, pScore0, pScore1)
  19. {
  20.    var s = "g=" + pGame + "&";
  21.    s += "d=" + pDisciple + "&";
  22.    s += "s0=" + pScore0 + "&";
  23.    s += "s1=" + pScore1 + "&";
  24.    s += "se=" + escape(session);
  25.    s += "&c=42";
  26.    var urlSubmit = this.urlSubmit + "?s=" + escape(this.encrypt(this.encrypt(s,this.keystring),this.keystring2));
  27.    getURL(urlSubmit,"_blank");
  28. };
  29. _global.api.highscore.encrypt = function(text, pKey)
  30. {
  31.    var crypt = "";
  32.    var checkSum = 0;
  33.    var shift;
  34.    var code;
  35.    var i = 0;
  36.    while(i < text.length)
  37.    {
  38.       char = this.charTableIndex[text.charCodeAt(i)];
  39.       shift = this.charTableIndex[pKey.charCodeAt(i % pKey.length)];
  40.       code = char + shift + checkSum;
  41.       code %= this.charTable.length;
  42.       crypt += this.charTable.charAt(code);
  43.       checkSum += code;
  44.       i++;
  45.    }
  46.    checkSum %= this.charTable.length;
  47.    return crypt + "" + this.charTable.charAt(checkSum);
  48. };
  49. _global.api.highscore.charTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
  50. _global.api.highscore.keystring = "whytheheckdoyouwasteyourtimehackingthishighscorelist";
  51. _global.api.highscore.keystring2 = "AnotherKey4You2FindOut4815jiagIOm30JK";
  52. _global.api.highscore.urlSubmit = "http://www.neodelight.com/v4/high_enter.php";
  53. _global.api.highscore.initSession();
  54.